package com.fancy.learncenter.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.fancy.learncenter.R;
import com.fancy.learncenter.ui.activity.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

public class EditTextActivity extends BaseActivity {

    public static String ACTIVITY_NAME_KEY = "ACTIVITY_NAME_KEY";
    public static String RESULT_CODE_KEY = "RESULT_CODE_KEY";
    String activityName;

    int resultCode;
    @Bind(R.id.content)
    EditText content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_text, Status.STATUS);
        ButterKnife.bind(this);
        activityName = getIntent().getStringExtra(ACTIVITY_NAME_KEY);
        resultCode = getIntent().getIntExtra(RESULT_CODE_KEY, 0);
        initToolbar(activityName);

        setRight("完成", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = getIntent();
                intent.putExtra(CartoonCreatClassActivity.NAME_KEY, content.getText().toString());
                setResult(resultCode, intent);
                finish();
            }
        });
    }
}
